package com.tasogo.comm;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.ImageView;

public class AlphaView extends ImageView
{
  private Drawable a;
  private boolean b;
  private int c;
  private String[] d;
  private a e;

  public AlphaView(Context paramContext)
  {
    super(paramContext);
    a();
  }

  public AlphaView(Context paramContext, AttributeSet paramAttributeSet)
  {
    super(paramContext, paramAttributeSet);
    a();
  }

  public AlphaView(Context paramContext, AttributeSet paramAttributeSet, int paramInt)
  {
    super(paramContext, paramAttributeSet, paramInt);
    a();
  }

  private void a()
  {
    int i = 0;
    this.b = false;
    this.c = -1;
    setImageResource(2130837507);
    this.a = getDrawable();
    this.d = new String[28];
    this.d[0] = "*";
    this.d[27] = "#";
    while (true)
    {
      if (i >= 26)
        return;
      this.d[(i + 1)] = String.valueOf((char)(i + 65));
      i += 1;
    }
  }

  public final void a(a parama)
  {
    this.e = parama;
  }

  public boolean dispatchTouchEvent(MotionEvent paramMotionEvent)
  {
    float f = paramMotionEvent.getY();
    int i = this.c;
    int j = (int)(f / getHeight() * 28.0F);
    switch (paramMotionEvent.getAction())
    {
    default:
      return true;
    case 0:
      this.b = true;
      if ((i != j) && (this.e != null) && (j >= 0) && (j < this.d.length))
      {
        this.e.a(this.d[j]);
        this.c = j;
      }
      invalidate();
      return true;
    case 2:
      if ((i != j) && (this.e != null) && (j >= 0) && (j < this.d.length))
      {
        this.e.a(this.d[j]);
        this.c = j;
      }
      invalidate();
      return true;
    case 1:
    }
    this.b = false;
    this.c = -1;
    invalidate();
    return true;
  }

  protected void onDraw(Canvas paramCanvas)
  {
    if (this.b)
    {
      setImageResource(2130837509);
      this.a = getDrawable();
      this.a.setBounds(0, 0, getWidth(), getHeight());
    }
    while (true)
    {
      paramCanvas.save();
      this.a.draw(paramCanvas);
      paramCanvas.restore();
      return;
      setImageResource(2130837507);
      this.a = getDrawable();
      this.a.setBounds(0, 0, getWidth(), getHeight());
    }
  }
}